#!/bin/bash
# Copyright (C) 2012 Brett Ponsler
# This file is part of pysiriproxy.
#
# pysiriproxy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pysiriproxy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pysiriproxy.  If not, see <http://www.gnu.org/licenses/>.
# Build and install amp, and then pysiriproxy.


# Modify these as necessary
BUILD_DOC=0
SYNC_CONFIG=0

# Build source distribution and upload
# python setup.py sdist upload

# Build binary distribution egg and upload
# python setup.py bdist_egg upload

# Build and install pysiriproxy onto the local machine.
py=/usr/bin/python
$py setup.py build && sudo $py setup.py install 

# Build doc only if specified
if [ $BUILD_DOC -eq 1 ]; then
    pushd doc >> /dev/null && make html && popd >> /dev/null
fi

# Sync the configuration directory only if specified
if [ $SYNC_CONFIG -eq 1 ]; then
   # Copy the configuration data to the user's configuration directory
   # Be sure to exclude all SVN directories
   echo "Copying configuration files into pysiriproxy config directory..."
   rsync -av --exclude='.svn' ./config/ ~/.pysiriproxy/.
fi